package com.wlcj.util;

import org.apache.commons.lang.StringUtils;
import org.springframework.context.ApplicationContext;

@SuppressWarnings("unchecked")
public class SpringUtil {
	
	public static ApplicationContext ctx = null;
	
	public static <T> T getBean(Class<T> clazz) {
		return (T)ctx.getBean(StringUtils.uncapitalize(clazz.getSimpleName()));
	}
	
	public static <T> T getBean(String name) {
		return (T)ctx.getBean(name);
	}
	
	public static void main(String[] args) {
		System.out.println(StringUtils.uncapitalize("Tgjhk"));
	}

}
